.<template>
  <div class="site-wrapper" :class="{ 'site-sidebar--fold': sidebarFold }" v-loading.fullscreen.lock="loading" element-loading-text="拼命加载中">
    <template v-if="!loading">
      <main-navbar />
      <main-sidebar />
      <div class="site-content__wrapper" :style="{ 'min-height': documentClientHeight + 'px' }">
        <main-content />
      </div>
      <footer-content></footer-content>
    </template>
    <back-top-content></back-top-content>
  </div>
</template>

<script>
import MainNavbar from '@/views/modules/main/main-navbar'
import MainSidebar from '@/views/modules/main/main-sidebar'
import MainContent from '@/views/modules/main/main-content'
import FooterContent from '@/components/common/footer-content'
import BackTopContent from '@/components/common/backtop-content'
export default {
  data() {
    return {
      loading: true
    }
  },
  components: {
    MainNavbar,
    MainSidebar,
    MainContent,
    FooterContent,
    BackTopContent
  },
  computed: {
    documentClientHeight: {
      get() {
        return this.$store.getters.documentClientHeight
      },
      set(val) {
        this.$store.commit('common/SET_DOCUMENTCLIENTHEIGHT', val)
      }
    },
    sidebarFold: {
      get() {
        return this.$store.getters.sidebarFold
      }
    }
  },
  created: function() {
    this.$store.dispatch('user/getUserInfo').then(res => {
      this.loading = false
    })
    this.listSysParam()
  },
  mounted: function() {
    this.resetDocumentClientHeight()
  },
  methods: {
    // 重置窗口可视高度
    resetDocumentClientHeight() {
      let occupyHeight = 100
      this.documentClientHeight = document.documentElement['clientHeight'] - occupyHeight
      window.onresize = () => {
        this.documentClientHeight = document.documentElement['clientHeight'] - occupyHeight
      }
    },
    // 获取参数
    listSysParam() {
      // this.$http({
      //   url: this.$http.adornUrl('/admin/sys/param/all'),
      //   method: 'get',
      //   params: this.$http.adornParams()
      // }).then(({ data }) => {
      //   if (data && data.code === 200) {
      //     localStorage.setItem('sysParamList', JSON.stringify(data.sysParamList))
      //   }
      // })
    }
  }
}
</script>

<style></style>
